package com.atguigu.juc.t6;

public class T1 {
    public static void main(String[] args) {
        RedSpider redSpider = new RedSpider();
           new Thread(()->{
               redSpider.write("开始上课！！！");
           },"老师1").start();

//        new Thread(()->{
//            redSpider.write("下课！！！");
//        },"老师2").start();


        for (int i = 1; i <= 30; i++) {
            new Thread(()->{
                Object read = redSpider.read();
                System.out.println(Thread.currentThread().getName() + "读取到内容为" + read);
            },"同学小" + i).start();
        }
    }
}
